import { axios } from '@/utils/request'

const api = {
  get_list: '/storage/get-list',
  get_option: '/storage/storage-option',
  upload_images: '/storage/upload-images',
  upload_videos: '/storage/upload-videos',
  upload_xlsx: '/storage/upload-xlsx',
  add_dir: '/storage/add-dir',
  rename: '/storage/rename',
  delete: '/storage/delete',
  delete_dir: '/storage/delete-dir',
  get_dir_tree: '/storage/get-dir-tree',
  drag_dir: '/storage/drag-dir',
  upload_crt: '/storage/upload-crt',
  upload_app: '/storage/upload-app',
}

export default api

export function getList(parameter) {
  return axios({
    url: api.get_list,
    method: 'get',
    params: parameter,
  })
}

export function addDir(parameter) {
  return axios({
    url: api.add_dir,
    method: 'post',
    data: parameter,
  })
}

export function rename(parameter) {
  return axios({
    url: api.rename,
    method: 'post',
    data: parameter,
  })
}

export function deleteRes(parameter) {
  return axios({
    url: api.delete,
    method: 'post',
    data: parameter,
  })
}

export function deleteDir(parameter) {
  return axios({
    url: api.delete_dir,
    method: 'post',
    data: parameter,
  })
}

export function dragDir(parameter) {
  return axios({
    url: api.drag_dir,
    method: 'post',
    data: parameter,
  })
}

export function getDirTree(parameter) {
  return axios({
    url: api.get_dir_tree,
    method: 'get',
    params: parameter,
  })
}

export function getOption() {
  return axios({
    url: api.get_option,
    method: 'get',
  })
}

export function uploadImages(parameter) {
  return axios({
    url: api.upload_images,
    method: 'post',
    data: parameter,
  })
}

export function uploadVideos(parameter) {
  return axios({
    url: api.upload_videos,
    method: 'post',
    data: parameter,
  })
}
